<?php
/**
 * beimuaihui System
 * Copyright(c) 2011-2020 beimuaihui.
 * @license    http://www.gnu.org/licenses/gpl.html     This software Under GPL V3 License 
 * beimuaihui@gmail.com
 * http://code.google.com/p/beimuaihui/
 * $Id: User.php 262 2011-07-23 15:51:14Z beimuaihui $
 */


Zend_Loader::loadClass("Baogg_Db_Table");

//class Permission extends Baogg_Db_Table {
class User  extends Baogg_Db_Table {
	/**
	 * The default table name 
	 */
	protected $_name;
	protected $_db ;
	protected $_primary; 
	
	function __construct() {
		$this->_name = 'user';
		
		$this->primary= $this->_primary='user_id';
		parent::__construct();
	}
	
	

	function getSame($arr) {	
		$ret=array();
		
		$where['user_name']=$arr['user_name'];
		
	    
		return parent::getSame($where); 	
	
	}
	
	function isAdmin($user_id=0)
	{


		if(!$user_id || $user_id==@$_SESSION['admin']['user']['user_id']){
			return @$_SESSION['admin']['user']['user_level_id']==1;
		}else{
			$user=$this->getOne($user_id);
			//echo $user_id;
			return @$user[0]['user_level_id']==1;
		}
	}
	
	


}
